1. Field of the Invention
The present invention relates to an apparatus for collecting garbage blocks of a nonvolatile memory, and more particularly, to an apparatus for collecting garbage blocks of a nonvolatile memory according to a power state and a method of collecting the same, in which the amount of power consumed by a portable device can be reduced by adjusting a garbage block collection operation on the basis of the power state of the portable device.
2. Description of the Related Art
Generally, in a flash memory, new data cannot be rewritten on a page on which data is already written, and the existing data should be erased in a unit of a block so as to rewrite the new data. In this case, the flash memory refers to a representative nonvolatile memory in which written data is not erased, even if power supply is stopped.
Further, when the data written on a page is changed, new data is written on another page, and the previous data is moved to an invalid region to be managed. Therefore, a garbage block collection process is required.
FIG. 1 is a diagram illustrating an operation of performing garbage block collection in a conventional flash memory.
As shown in FIG. 1, according to the garbage block collection operation, only valid pages in specific blocks are copied to another block, and the corresponding blocks are erased so as to be reused.
In order to perform the garbage block collection process, writing and erasing processes are required. However, it takes a long time for the above-described garbage block collection process to be performed, and a large capacity of power is also consumed, as shown in Table 1.
TABLE 1OperationTimePowerRead (one page)37μS1.2 μJProgram (one page)306μS8.3 μJDelete (one block)1.8mS21.9 μJ 
Further, when a flash memory is used in a mobile system, which operates using a battery, like a wireless terminal, it affects an allowable time of the battery to perform the garbage block collection process.
A conventional garbage block collecting system divides a flash memory into free blocks and allocated blocks, and includes a free block list and an allocated block list that manage the free blocks and the allocated blocks, respectively.
Further, the garbage block collecting system includes a garbage block collector that searches a corresponding allocated block from the allocated block list to delete it and then transmits it to the free block list, and a block allocator that allocates a predetermined block and requests the garbage block collector to perform garbage block collection.
For example, all blocks that are initially not used enter into the free block list, and if a new block is required so as to write data in the flash memory, the block allocator requests the free block list to allocate the new block. The free block list allocates one of the free blocks. In this case, the allocated block is added to the allocated block list.
Then, when the free blocks do not exist in the free block list and when available free blocks are smaller than data to be newly stored, the block allocator requests the garbage block collector to perform garbage block collection.
After the garbage block collector searches the allocated block in the allocated block list to delete it, the garbage block collector transmits the allocated block to the free block list. In this case, even when the garbage block collector is not requested to perform garbage block collection from an external apparatus, the garbage block collector may perform a garbage block collection process at a specific cycle time by using a timer, or perform the garbage block collection process when it is determined by a system idle detector that a system enters an idle state.
However, in order to search all allocated blocks in the allocated block list or reduce a garbage block collection operation time, the garbage block collector searches only a predetermined number of allocated blocks, and transmits them to the free block list. That is, the number of the allocated blocks deleted by the garbage block collector does not depend on a power state of a wireless terminal.
Accordingly, when a remaining battery capacity of the wireless terminal is insufficient, if the garbage block collector performs garbage block collection, a power of the battery is further consumed, and thus the remaining battery capacity may be further insufficient.
Korean Laid-Open Publication No. 2004-0104203 discloses a method of collecting garbage data in a mobile communication terminal, in which when collecting garbage data of a flash memory is performed or required in the mobile communication terminal, a mode of the mobile communication terminal is converted into a low power mode for a short time so as to prevent interruption from an external apparatus and the terminal performs normal garbage data collection, thereby causing the terminal to stably operate. However, in the above-described method, a technology for performing garbage block collection according to a power state of the wireless terminal is not described.